package com.gxuwz.zlc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gxuwz.zlc.entity.Assistant;
import com.gxuwz.zlc.mapper.AssistantMapper;
import com.gxuwz.zlc.service.AssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AssistantServiceImpl implements AssistantService {

    @Autowired
    private AssistantMapper assistantMapper;

    @Override
    public List<Assistant> findAssistant() {
        return assistantMapper.selectList(null);
    }

    @Override
    public Assistant findAssistantById(String assistantId) {
        return assistantMapper.selectById(assistantId);
    }

    @Override
    public void addAssistant(Assistant assistant) {
        assistantMapper.insert(assistant);
    }

    @Override
    public void updateAssistant(Assistant assistant) {
        assistantMapper.updateById(assistant);
    }

    @Override
    public void deleteAssistant(String assistantId) {
        assistantMapper.deleteById(assistantId);
    }

    @Override
    public Assistant findAssistantByStuId(String stuId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("stu_Id",stuId);
        return assistantMapper.selectOne(wrapper);
    }
}
